<%-- 
    Document   : viewAll
    Created on : May 20, 2013, 9:14:00 PM
    Author     : quannq
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<c:if test="${loaiSach eq 'Search'}">    
    <h1>Tìm thấy ${numSach} kết quả chứa từ "${noidung}"</h1>
</c:if>
<div class="pagination-container" id="pagination_contents">
    <div class="pagination cm-pagination-wraper center clear">
        <div class="p-list-nav p-list-nav-top">

            <div class="p-list-func clearfix">
                <div class="p-list-sort">Hiển thị từ <strong>${curPage*10-9}</strong> đến 
                    <strong>
                        <c:if test="${(numSach-curPage*10)>0}">${curPage*10}</c:if>
                        <c:if test="${(numSach-curPage*10)<=0}">${numSach}</c:if>
                    </strong> trong <strong>${numSach}</strong> sản phẩm</div>
                <div class="p-list-page">
                    <ul>
                        <c:forEach begin="1" end="${numPage}" var="num">
                            <c:if test="${curPage eq num}">
                                <li>${num}</li>
                                </c:if>
                                <c:if test="${curPage != num}">
                                    <c:if test="${loaiSach eq 'KM'}">
                                    <li><a href="${pageContext.request.contextPath}/view-all-khuyen-mai/page/${num}">${num}</a></li>
                                    </c:if>
                                    <c:if test="${loaiSach eq 'Khac'}">
                                    <li><a href="${pageContext.request.contextPath}/view-all-khac/page/${num}">${num}</a></li>
                                    </c:if>
                                    <c:if test="${loaiSach eq 'KMTl1'}">
                                    <li><a href="${pageContext.request.contextPath}/view-all-khuyen-mai/${id1}/page/${num}">${num}</a></li>
                                    </c:if>
                                    <c:if test="${loaiSach eq 'KhacTl1'}">
                                    <li><a href="${pageContext.request.contextPath}/view-all-khac/${id1}/page/${num}">${num}</a></li>
                                    </c:if>
                                    <c:if test="${loaiSach eq 'KMTl2'}">
                                    <li><a href="${pageContext.request.contextPath}/view-all-khuyen-mai/${id1}/${id2}/page/${num}">${num}</a></li>
                                    </c:if>
                                    <c:if test="${loaiSach eq 'KhacTl2'}">
                                    <li><a href="${pageContext.request.contextPath}/view-all-khac/${id1}/${id2}/page/${num}">${num}</a></li>
                                    </c:if>
                                    <c:if test="${loaiSach eq 'All3'}">
                                    <li><a href="${pageContext.request.contextPath}/sach-the-loai/${id1}/${id2}/${TheLoai3Id.matl3}/page/${num}">${num}</a></li>
                                    </c:if>
                                    <c:if test="${loaiSach eq 'Search'}">
                                    <li><a href="${pageContext.request.contextPath}/timkiem?hint_q=${noidung}&cid=${cid}&page=${num}">${num}</a></li>
                                    </c:if>

                            </c:if>
                        </c:forEach>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <div class="product_list">
        <c:forEach items="${Sach}" var="sach">
            <div class="product_item clearfix first">
                <div class="num"><!--STT sach --></div>
                <div class="thumb center" style="width:120px">
                    <a href="${pageContext.request.contextPath}/view-sach/${sach.masach}" title="${sach.tensach}">
                        <img class="" src="${pageContext.request.contextPath}/image/sell/${sach.anhbia}" alt="${sach.tensach}" border="0" height="143" width="95"/>
                    </a>
                    <div style="margin-top: 5px; text-align: center; color: rgb(102, 102, 102); font-size: 11px;">Mã:${sach.masach}</div>
                </div>
                <!-- /.thumb -->

                <div class="info sale">
                    <h2><a href="${pageContext.request.contextPath}/view-sach/${sach.masach}">${sach.tensach}</a>
                    </h2>
                    <p class="produect_feature">
                        Tác giả:&nbsp;<span><a href="#">${sach.tacgia.tentacgia}</a></span><br>
                        ${sach.loaibia.tenloaibia}.&nbsp;Xuất bản&nbsp; ${sach.namxb}.&nbsp;
                        <span>
                            <a href="#">${sach.nhaxuatban.tennxb}</a>
                        </span><br>
                        Số trang: ${sach.sotrang}.&nbsp;Kích thước: ${sach.kichthuoc}.&nbsp;Cân nặng: ${sach.cannang}&nbsp;gr
                    </p>

                    <div class="clearfix">
                        <dl class="clearfix">
                            <dt>Giá bìa:</dt>
                            <dd class="price_bia"><span><span id="sec_original_price_71606">${sach.giabia}</span>&nbsp;VNĐ</span>
                            </dd>
                            <dt>Giá bán:</dt>
                            <dd class="price_ban">
                                <span><span id="sec_sell_price_71606">${sach.giabia-(sach.giabia*sach.giamgia/100)}</span>&nbsp;VNĐ</span>
                            </dd>
                        </dl>
                    </div>       
                </div>
                <!-- /.info -->
                <%--<sec:authorize  access="hasRole('ROLE_USER')">--%>
                <div class="product_function">
                    <form class="cm-ajax" action="" method="post" name="product_form_71606" enctype="multipart/form-data">
                        <c:if test="${sach.soluong>0}">
                            <div name="" class="p-button p-add-to-cart p-button-red cm-submit-link" onclick="">
                                <span class="p-button-start"><span class="p-addcart-icon"></span>Cho vào giỏ hàng</span>
                                <span class="p-button-end"></span>
                            </div>
                        </c:if>
                        <c:if test="${sach.soluong eq 0}">
                            <div name="" class="p-button p-button-black cm-submit-link">
                                <span class="p-button-start">Sản phẩm đã hết hàng</span>
                                <span class="p-button-end"/>
                            </div>
                        </c:if>
                    </form>
                </div>
                <%--</sec:authorize>--%>
                <!-- /.product_function -->        
            </div>
        </c:forEach>
        <!-- /.product_item -->
    </div>
</div>
